/**
 * Created by Luji on 2017/03/27.
 */
class Edit {
    constructor(version , $modalInstance , imageSrv , ctgNotification) {
        "ngInject";
        this._modalInstance = $modalInstance;
        this._notification  = ctgNotification;
        this._imageSrv      = imageSrv;
        this.version        = version;
        console.log(this.version)
    }
    cancel() {
        this._modalInstance.dismiss('cancel');
    }
    save(){
        this._imageSrv.editHarborVersions({
            imageFileId: this.version.dockerImageFileId?this.version.dockerImageFileId:'',
            imageIndexId: this.version.id?this.version.id:'',
            imageName: this.version.imageName,
            servicePort: this.version.servicePort,
            version: this.version.version,
        }).then(data=> {
            this._modalInstance.close();
            this._notification.success('修改端口号成功.');
        }).catch((data)=> {
            this._notification.error(data.resultMsg);
        });
    }
}
export default Edit